<div class="info">
<h1 class="font_h1">Tạo mới sản phẩm</h1>
<?php if(isset($error))  : ?>
<h2 class="error_red"><?php echo $error;?></h2>
<?php endif;?>
<form id="frm_add" action="<?php echo base_url().'admin/product/add_update/'.@$uid?>" method="POST" enctype="multipart/form-data">
<table class="table1">
    <tr>
                <td width="20%">Tên sản phẩm(Tiếng việt)</td>
                <td width="80%">
                	<?php if(@$products->name_product!='') {?>
                    <input type="text" name="txt_name_product" style="width:400px" value="<?=@$products->name_product;?>" />
                    <?php } else { ?>
                    <input type="text" name="txt_name_product" style="width:400px" value="<?php set_value('txt_name_product');?>"  />
                    <?php } ?>
                </td>
    </tr>   
    <tr>
                <td width="20%"></td>
                <td width="80%">
                	<span style="background: red;width:200px"><?php echo form_error('txt_name_product');?></span>
                </td>
    </tr> 
    <tr>
                <td width="20%">Mã sản phẩm</td>
                <td width="80%">
                	<?php if(@$products->ms!='') {?>
                    <input type="text" name="txt_ms" style="width:400px" value="<?=@$products->ms;?>" />
                    <?php } else { ?>
                    <input type="text" name="txt_ms" style="width:400px" value="<?php set_value('txt_ms');?>"  />
                    <?php } ?>
                </td>
    </tr>   
    <tr>
                <td width="20%"></td>
                <td width="80%">
                	<span style="background: red;width:200px"><?php echo form_error('txt_ms');?></span>
                </td>
    </tr> 
      
    <tr>
                <td width="20%">Meta Keyword</td>
                <td width="80%">
                	<?php if(@$products->meta_keyword!='') {?>
                    <textarea name="txt_meta_keyword" style="width:400px; height:150px"><?=@$products->meta_keyword;?></textarea>                    
                    <?php } else { ?>
                    <textarea name="txt_meta_keyword" style="width:400px; height:150px"></textarea>
                    <?php } ?>
                </td>
    </tr>   
    <tr>
                <td width="20%">Meta description</td>
                <td width="80%">
                	<?php if(@$products->meta_description!='') {?>
                    <textarea name="txt_meta_description" style="width:400px; height:150px"><?=@$products->meta_description;?></textarea>                    
                    <?php } else { ?>
                    <textarea name="txt_meta_description" style="width:400px; height:150px"></textarea>
                    <?php } ?>
                </td>
    </tr> 
     <tr>
                <td width="20%">Nội dung</td>
                <td width="80%">
                	<?php if(@$products->meta_description!='') {?>
                    <textarea class="ckeditor" name="txt_description"><?=@$products->description;?></textarea>                    
                    <?php } else { ?>
                    <textarea class="ckeditor" name="txt_description"></textarea>
                    <?php } ?>
                </td>
    </tr> 
      <tr>
                <td width="20%"></td>
                <td width="80%">
                	<span style="background: red;width:200px"><?php echo form_error('txt_description');?></span>
                </td>
    </tr> 
    <tr>
                <td width="20%">Giá</td>
                <td width="80%">
                	<?php if(@$products->price!='') {?>
                    <input type="text" name="txt_price" style="width:400px" value="<?=@$products->price;?>" />
                    <?php } else { ?>
                    <input type="text" name="txt_price" style="width:400px"  />
                    <?php } ?>
                </td>
    </tr>
    <tr>
                <td width="20%"></td>
                <td width="80%">
                	<span style="background: red;width:200px"><?php echo form_error('txt_price');?></span>
                </td>
    </tr> 
     <tr>
                <td width="20%">Thứ tự</td>
                <td width="80%">
                	<?php if(@$products->order_product!='') {?>
                    <input type="text" name="txt_order_product" style="width:400px" value="<?=@$products->order_product;?>" />
                    <?php } else { ?>
                    <input type="text" name="txt_order_product" style="width:400px"  />
                    <?php } ?>
                </td>
    </tr>
    <tr>
                <td width="20%">Danh mục cha</td>
                <td width="80%">
                	<select style="width: 200px;" name="txt_id_cats">
                    <option value="">---------------Chọn----------</option>
                        <?php foreach($products_parent as $row){?>
                            <?php if($products->id_cats == $row->id_cats){ ?>
                            <option value="<?php echo $row->id_cats;?>"<?php set_select('txt_id_cats',$row->id_cats);?> selected="selected"><?php echo $row->name_cats;?></option> 
                            <?php } else {?>
                            
                            <option value="<?php echo $row->id_cats;?>"<?php set_select('txt_id_cats',$row->id_cats);?>><?php echo $row->name_cats;?></option>
                            <?php } ?>                            
                        <?php } ?>
                        
                    </select>
                </td>
    </tr>
    <tr>
                <td width="20%"></td>
                <td width="80%">
                	<span style="background: red;width:200px"><?php echo form_error('txt_id_cats');?></span>
                </td>
    </tr> 
     <tr>
                <td width="20%">Hình ảnh</td>
                <td width="80%">
                	<img src="<?php echo base_url().@$products->image_thumb;?>" /><br />
                    <input type="hidden" name="image" value="<?php echo @$products->image;?>" />
                    <input type="hidden" name="image_thumb" value="<?php echo @$products->image_thumb;?>" />
                    <input type="file" name="p_image" />
                </td>
    </tr>
    <tr>
                <td width="20%">Hiện thị</td>
                <td width="80%">
                	<select name="txt_active" style="width: 200px;">
                        <option value="0" <?php if(@$products->active == 0) echo "selected";?>>Không</option>
                        <option value="1" <?php if(@$products->active == 1) echo "selected";?>>Có</option>
                    </select>
                </td>
    </tr>
    <tr>
                <td width="20%"  rowspan="5">Vị trí show</td>
          </tr>
          <tr>      
                <td width="80%">                       
                    <input type="checkbox" value="1" <?php if(@$products->vitri_show == 1) echo "checked";?> style="float: left;" name="txt_vitri_show" /><span style="line-height:25px; padding:5px">Sản phẩm Trang chủ</span></td>
                   
                </td>
                
          </tr>
          <tr>      
                <td width="80%">                       
                    <input type="checkbox" value="1" <?php if(@$products->vitri_right == 1) echo "checked";?> style="float: left;" name="txt_vt_right" /><span style="line-height:25px; padding:5px">Sản phẩm khuyến mãi</span></td>
                   
                </td>
                
          </tr>
          <tr>      
                <td width="80%">                       
                   <input type="checkbox" value="1" <?php if(@$products->vitri_left == 1) echo "checked";?> style="float: left;" name="txt_vt_left" /><span style="line-height:25px; padding:5px">Sản phẩm mới</span></td>
                   
                </td>
                
          </tr>
          <tr>      
                <td width="80%">                       
                    <input type="checkbox" value="1" <?php if(@$products->slidershow == 1) echo "checked";?> style="float: left;" name="txt_vt_slidershow" /><span style="line-height:25px; padding:5px">Sản phẩm slider</span></td>
                   
                </td>
                
          </tr>
    <tr>
                <td width="20%"></td>
                <td width="80%">
                	<a  class="button" onclick="$('#frm_add').submit()" href="javascript:void(0)">Lưu lại</a>
                 <a  class="button" href="<?php echo base_url().'admin/product/'?>">Quay lại</a>
                </td>
    </tr>
</table>
</form>
</div>
               